bitkeeper revision 1.1159.170.2 (418fc0cbyeYILYK3WoFh0bVv3e_-KA)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Mon, 8 Nov 2004 18:54:03 +0000 (18:54 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Mon, 8 Nov 2004 18:54:03 +0000 (18:54 +0000)
Allow users of SAVE_ALL and SET_XEN_SEGMENTS to specify which register
is to be clobbered on return.

xen/arch/x86/x86_32/entry.S
xen/include/asm-x86/irq.h
xen/include/asm-x86/x86_32/asm_defns.h

index 474b399b59932a207ea10025c088b7e462222faa..d0dba03cdec465a7e87c7e2989c2908124e09eed 100644 (file)
@@ -181,7 +181,7 @@ restore_all_guest:
        pushl %edx
        pushl %ecx
        pushl %ebx
-7:      SET_XEN_SEGMENTS
+7:      SET_XEN_SEGMENTS(a)
         jmp failsafe_callback
 .previous
 .section __ex_table,"a"
@@ -239,7 +239,7 @@ restore_all_xen:
         ALIGN
 ENTRY(hypercall)
         pushl %eax                     # save orig_eax
-       SAVE_ALL
+       SAVE_ALL(b)
         sti
         GET_CURRENT(%ebx)
        andl $(NR_hypercalls-1),%eax
@@ -351,7 +351,7 @@ FAULT12:movl %eax,%gs:8(%esi)
 .section .fixup,"ax"
 crash_domain_fixup1:
         subl  $4,%esp
-        SAVE_ALL
+        SAVE_ALL(a)
         sti
         jmp   domain_crash
 crash_domain_fixup2:
@@ -410,7 +410,7 @@ error_code:
         movl %es,XREGS_es(%esp)
         movl %fs,XREGS_fs(%esp)
         movl %gs,XREGS_gs(%esp)
-1:      SET_XEN_SEGMENTS
+1:      SET_XEN_SEGMENTS(b)
        movl  XREGS_orig_eax(%esp),%esi         # get the error code
        movl  XREGS_eax(%esp),%edi              # get the function address
        movl  %eax,XREGS_eax(%esp)
@@ -508,7 +508,7 @@ ENTRY(nmi)
         # Save state but do not trash the segment registers!
         # We may otherwise be unable to reload them or copy them to ring 1. 
        pushl %eax
-       SAVE_ALL_NOSEGREGS
+       SAVE_ALL_NOSEGREGS(a)
 
         # Check for hardware problems.
         inb   $0x61,%al
index 3b71f7f0a0a25639aac56d5a8aac8e2ab3e86e84..f0a8955fa99f7bfdbf5f502775ae198a711eb1ae 100644 (file)
@@ -92,7 +92,7 @@ __asm__( \
 "\n"__ALIGN_STR"\n" \
 SYMBOL_NAME_STR(x) ":\n\t" \
        "push"__OS" $"#v"\n\t" \
-       SAVE_ALL \
+       SAVE_ALL(a) \
        SYMBOL_NAME_STR(call_##x)":\n\t" \
        "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
        "jmp ret_from_intr\n");
@@ -105,7 +105,7 @@ __asm__( \
 "\n"__ALIGN_STR"\n" \
 SYMBOL_NAME_STR(x) ":\n\t" \
        "push"__OS" $"#v"\n\t" \
-       SAVE_ALL \
+       SAVE_ALL(a) \
        "mov %"__OP"sp,%"__OP"ax\n\t" \
        "push %"__OP"ax\n\t" \
        SYMBOL_NAME_STR(call_##x)":\n\t" \
@@ -118,7 +118,7 @@ asmlinkage void call_do_IRQ(void); \
 __asm__( \
        "\n" __ALIGN_STR"\n" \
        "common_interrupt:\n\t" \
-       SAVE_ALL \
+       SAVE_ALL(a) \
        SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
        "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \
        "jmp ret_from_intr\n");
index 0f022d38a2493502689cd0b3cd42a600366b1408..37efa678795b1eb9a1bd0ed89f9831fccc500d45 100644 (file)
@@ -53,7 +53,7 @@
 /* AUTO-GENERATE the following two cases (quoted vs. unquoted). */
 #ifndef __ASSEMBLY__
 
-#define __SAVE_ALL_PRE \
+#define __SAVE_ALL_PRE(_reg) \
         "cld;" \
         "pushl %eax;" \
         "pushl %ebp;" \
         "pushl %edx;" \
         "pushl %ecx;" \
         "pushl %ebx;" \
-        "movb "STR(XREGS_cs)"(%esp),%al;" \
-        "testb $3,%al;" \
+        "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \
+        "testb $3,%"STR(_reg)"l;" \
         "je 1f;" \
         "movl %ds,"STR(XREGS_ds)"(%esp);" \
         "movl %es,"STR(XREGS_es)"(%esp);" \
         "movl %fs,"STR(XREGS_fs)"(%esp);" \
         "movl %gs,"STR(XREGS_gs)"(%esp);"
 
-#define SAVE_ALL_NOSEGREGS \
-        __SAVE_ALL_PRE \
+#define SAVE_ALL_NOSEGREGS(_reg) \
+        __SAVE_ALL_PRE(_reg) \
         "1:"
 
-#define SET_XEN_SEGMENTS \
-        "movl $("STR(__HYPERVISOR_DS)"),%edx;" \
-        "movl %edx,%ds;" \
-        "movl %edx,%es;"
+#define SET_XEN_SEGMENTS(_reg) \
+        "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
+        "movl %e"STR(_reg)"x,%ds;" \
+        "movl %e"STR(_reg)"x,%es;"
 
-#define SAVE_ALL \
-        __SAVE_ALL_PRE \
-        SET_XEN_SEGMENTS \
+#define SAVE_ALL(_reg) \
+        __SAVE_ALL_PRE(_reg) \
+        SET_XEN_SEGMENTS(_reg) \
         "1:"
 
 #else
 
-#define __SAVE_ALL_PRE \
+#define __SAVE_ALL_PRE(_reg) \
         cld; \
         pushl %eax; \
         pushl %ebp; \
         pushl %edx; \
         pushl %ecx; \
         pushl %ebx; \
-        movb XREGS_cs(%esp),%dl; \
-        testb $3,%dl; \
+        movb XREGS_cs(%esp),% ## _reg ## l; \
+        testb $3,% ## _reg ## l; \
         je 1f; \
         movl %ds,XREGS_ds(%esp); \
         movl %es,XREGS_es(%esp); \
         movl %fs,XREGS_fs(%esp); \
         movl %gs,XREGS_gs(%esp);
 
-#define SAVE_ALL_NOSEGREGS \
-        __SAVE_ALL_PRE \
+#define SAVE_ALL_NOSEGREGS(_reg) \
+        __SAVE_ALL_PRE(_reg) \
         1:
 
-#define SET_XEN_SEGMENTS \
-        movl $(__HYPERVISOR_DS),%edx; \
-        movl %edx,%ds; \
-        movl %edx,%es;
+#define SET_XEN_SEGMENTS(_reg) \
+        movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
+        movl %e ## _reg ## x,%ds; \
+        movl %e ## _reg ## x,%es;
 
-#define SAVE_ALL \
-        __SAVE_ALL_PRE \
-        SET_XEN_SEGMENTS \
+#define SAVE_ALL(_reg) \
+        __SAVE_ALL_PRE(_reg) \
+        SET_XEN_SEGMENTS(_reg) \
         1:
 
 #endif